package rentals;

import java.util.*;

public abstract class Member {

	protected String name;
	protected ArrayList rentals;
	protected int dvdCount = 0;

	public abstract void rentDvd(Dvd dvd);
	
	public void returnDvd(Dvd dvd) {
		if (rentals.contains(dvd)) {
			rentals.remove(dvd);
			dvdCount -= 1;
		}
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String toString() {
		return name;
	}
	
	public void printRentals() {
		Iterator iter = rentals.iterator();
		System.out.println(toString() + " has rented : ");
		while(iter.hasNext())
			System.out.println(iter.next());
	}
}
